using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The TravelDocumentTypeCodeTableManager class is responsible for managing BO.TravelDocumentTypeCodeTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class TravelDocumentTypeCodeTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all TravelDocumentTypeCodeTable objects in the database.
/// </summary>
/// <returns>A list with all TravelDocumentTypeCodeTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static TravelDocumentTypeCodeTableList GetList(){
return TravelDocumentTypeCodeTableDB.GetList();
}

/// <summary>
/// Gets a single TravelDocumentTypeCodeTable from the database without its data.
/// </summary>
/// <param name="travelDocTypeCode">The TravelDocTypeCode of the TravelDocumentTypeCodeTable in the database.</param>
/// <returns>A TravelDocumentTypeCodeTable object when the TravelDocTypeCode exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TravelDocumentTypeCodeTable GetItem(Int16 travelDocTypeCode){
return GetItem(travelDocTypeCode, false);
}

/// <summary>
/// Gets a single TravelDocumentTypeCodeTable from the database.
/// </summary>
/// <param name="travelDocTypeCode">The TravelDocTypeCode of the TravelDocumentTypeCodeTable in the database.</param>
/// <param name="getTravelDocumentTypeCodeTableRecords">Determines whether to load all associated TravelDocumentTypeCodeTable records as well.</param>
/// <returns>
/// A TravelDocumentTypeCodeTable object when the TravelDocTypeCode exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TravelDocumentTypeCodeTable GetItem(Int16 travelDocTypeCode, bool getTravelDocumentTypeCodeTableRecords){
TravelDocumentTypeCodeTable myTravelDocumentTypeCodeTable = TravelDocumentTypeCodeTableDB.GetItem(travelDocTypeCode);
return myTravelDocumentTypeCodeTable;
}

/// <summary>
/// Saves a TravelDocumentTypeCodeTable in the database.
/// </summary>
/// <param name="myTravelDocumentTypeCodeTable">The TravelDocumentTypeCodeTable instance to save.</param>
/// <returns>The new TravelDocTypeCode if the TravelDocumentTypeCodeTable is new in the database or the existing TravelDocTypeCode when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static Int16 Save(TravelDocumentTypeCodeTable myTravelDocumentTypeCodeTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
Int16 travelDocumentTypeCodeTableTravelDocTypeCode = TravelDocumentTypeCodeTableDB.Save(myTravelDocumentTypeCodeTable);

//  Assign the TravelDocumentTypeCodeTable its new (or existing TravelDocTypeCode).
myTravelDocumentTypeCodeTable.TravelDocTypeCode = travelDocumentTypeCodeTableTravelDocTypeCode;

myTransactionScope.Complete();

return travelDocumentTypeCodeTableTravelDocTypeCode;
}
}

/// <summary>
/// Deletes a TravelDocumentTypeCodeTable from the database.
/// </summary>
/// <param name="myTravelDocumentTypeCodeTable">The TravelDocumentTypeCodeTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(TravelDocumentTypeCodeTable myTravelDocumentTypeCodeTable){
return TravelDocumentTypeCodeTableDB.Delete(myTravelDocumentTypeCodeTable.TravelDocTypeCode);
}

#endregion

}

